1. Field of the Invention
The invention relates to a method and system for motion estimation and, more particularly, to a method and system for adaptive motion estimation.
2. Description of Related Art
In the international video compression standards such as MPEGx H.26x, the inter-frame prediction that applies block matching to motion estimation is widely used to obtain high efficiency in motion picture data coding. FIG. 1 shows a flowchart of a typical inter-frame coding. As shown in FIG. 1, an MPEG system divides a frame into macroblocks (MBs) or sub-macroblocks wherein a macroblock is a 16×16 pixels block and sub-macroblocks can be 8×8 or 4×4 pixels block. For a previous frame (forward or backward) 11 and a current frame 12, when coding, a corresponding motion vector is found for each block 101′ of the previous frame 11 at first. Accordingly, motion estimation of the previous frame 11 can obtain a prediction frame 13. A difference frame 14 is obtained by comparing the prediction frame 13 and the current frame 12. As such, only the motion vectors and the difference frame 14 are required in transmission or storage, and effective compression is obtained. For decompression, the motion vectors and the difference frame 14 are sent to an MPEG decoder, and original blocks of the current frame 12 are restored by adding corresponding blocks read from the previous frame 11 based on the motion vectors and blocks of the difference frame 14.
As shown in FIG. 2, the motion estimation is based on each block 101 of the current frame 12 to find a corresponding block 101′ from the previous frame 11 within a search area 111, thereby obtaining the motion behavior of the block 101′ and thus determining a corresponding motion vector. Because the motion estimation requires performing block matching, it occupies a large proportion of the computation and the usable bandwidth in video compression, and the proportion occupied is essentially determined by a search range 111 to be set. If the search range 111 is too large, it causes a waste of computation so as to have poor compression efficiency. Conversely, when the search range 111 is too small, the desired block may not be found to cause a reduction of compression rate. Thus, it is an important subject to determine an appropriate search range 111.
Accordingly, FIG. 3 shows a typical method in which a previous motion vector determined by performing a previous motion estimation on an input target block 101 and the blocks 101′ within the search range 111 is temporarily stored in a motion vector memory 31. Thus, when a current motion estimation is performed on the input target block 101 and the blocks 101′ within the search range 111, a search range 1˜N is selected according to the previous motion vector stored in the motion vector memory 31. Such a method adjusts the search range only using the previous motion vector, and when a complicated video such as a scene change or a shaded background of a previous frame presents, it cannot provide an effective prediction of search range due to a large difference between the previous frame and a current frame. In addition, only the motion vector is used to adjust the search range, which easily causes the unstable search range adjustment due to the inaccurate motion estimation and further leads to the unstable compression frame quality. Therefore, it is desirable to provide an improved method and system for adaptive motion estimation to mitigate and/or obviate the aforementioned problems.